/* 
 * File:   main.cpp
 * Author: adipewpew
 *
 * Created on February 1, 2012, 10:54 AM
 */

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <set>
#include <fstream>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <cstdlib>

#include "Assignment2AdiCitizen.h"

using namespace std;

/*
 * 
 */
int main() 
{
    vector <Citizen> VectorCitizen;
    set <int> sCitizen;
    
    int choice;
    bool exit = false;
    while (!exit)
    
    {
        cout <<"///////////////////////////////////////////////////" <<endl;
        cout <<"//     Welcome to  the Citizen System program!    //" << endl;
    	cout <<"///////////////////////////////////////////////////" <<endl;
    	cout <<"//1)     Create New Citizen                      //" << endl;
    	cout <<"//2)     Modify Citizen Data                     //" << endl;
    	cout <<"//3)     Display Citizen Profile                 //" << endl;
    	cout <<"//4)     Delete Citizen                          //" << endl;
  	cout <<"//5)     Exit Program                            //" << endl;
    	cout <<"///////////////////////////////////////////////////" <<endl;
    	cout <<""  << endl;
    	
\\Modify citizen not included
    	
       
        cout <<"Please enter your choice: " ;
        cin >> choice;
        cout <<""<<endl;
        
        switch(choice)
        {
            case 1:
            {
               int accountID;
               string password;
               string name;
               
               IDinput: {
        cout <<"Enter Citizen ID: ";
        cin >> accountID;
        for (int count= 0; count < VectorCitizen.size(); count++)
        if (accountID == VectorCitizen[count].getID())
           {
             cout<< "" <<endl;
             cout<<"The ID " << accountID <<" has been used.Please use another ID"<<endl;
             cout<< "" <<endl;
             goto IDinput;
           }
            else
           {
                        
           }
           }
               
            cout <<"Enter Citizen Password: ";
            cin >> password;
            
            cout <<"Enter Citizen Name: ";
            cin >> name;
            
            Citizen Vectorcity;
            Vectorcity.setfields(accountID, password, name);
            VectorCitizen.push_back(Vectorcity);
               
            cout << "" << endl;
            cout << "New Citizen record successfully stored!" << endl;
            cout << "" << endl;
            cout << "" << endl;
    	break;
            }
            case 2:
            {
              // reserved and redirected to admin side
            break;    
            }
            case 3:
            {
              for (int count= 0; count < VectorCitizen.size(); count++)
              {
                  cout<<""<<endl;
                  VectorCitizen[count].displayCitizenData();
                  cout<<""<<endl;
              }
            break;    
            }
            case 4:
            {
                int accountID;
                
                cout<<"Enter ID of citizen to delete: ";
                cin >> accountID;
                
                for(int oerase=0;oerase<VectorCitizen.size();oerase++)
                {
                if (accountID == VectorCitizen[oerase].getID())
                {
                   VectorCitizen.erase(VectorCitizen.begin() + oerase);
                   cout<<endl;
                   cout << "Citizen has been deleted" << endl;
                   cout<<endl;
                }
                else
                {
                    //cout <<"No ID exist lar!" << endl;
                }

                
                }
                
               // cout<<endl;
                //cout << "Citizen has been deleted" << endl;
               // cout<<endl;
               // repeated message if checking for no member found
                
            break;    
            }
            case 5:
            {
                exit = true ;
                break;
            }    
        }        
    }
    return 0;
}

